<?php
namespace app\index\controller;

class Index
{
    public function index()
    {
		dump(time());
		$t = 1564628101;//time();// 56800235583;// 65650191794339;// time().time();
		
		dump($t);
		$aa = $this->aa($t);
		dump($aa);
		dump($this->bb($aa));
    }

    public function hello($name = 'ThinkPHP5')
    {
        return 'hello,' . $name;
    }
	
	
	public function aa($num){
		//$num = intval($num);
		//dump($num );
		if ($num < 0) return false;
		$charArr = array("0","1","2","3","4","5","6","7","8","9",'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
		
		//$charArr = array("0","1","2","3","4","5","6","7","8","9",'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X', 'Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
		
		$char = '';
		
		do {
			//$key = ($num - 1) % 36;
			$key = ($num ) % 36;			
			$char= $charArr[$key] . $char;
			$num = floor(($num - $key) / 36);
		} while ($num > 0);
		return $char;
	}
	
	public function bb($char){
		
		$charArr=array("0","1","2","3","4","5","6","7","8","9","A", "B", "C", "D","E", "F", "G", "H", "I", "J", "K", "L","M", "N", "O","P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y","Z");
		
		//$charArr = array("0","1","2","3","4","5","6","7","8","9",'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X', 'Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
		
		$len=strlen($char);
		
		for($i=0;$i<$len;$i++){
			$index=array_search($char[$i],$charArr);
			//$sum+=($index+1)*pow(36,$len-$i-1);
			$sum+=($index)*pow(36,$len-$i-1);
			//$sum  = bcadd( $sum , ($index)*bcpow(62,$len-$i-1) );
		}
		return $sum;
	}
}
